import React, {useState} from "react";
import { Chart as PieChart } from 'react-google-charts';
import { Select } from 'antd';
// import { useEffect, useState } from 'react'

import { useDispatch } from 'react-redux'

const sOptions = [
    {
        value: 'bar',
        label: '饼状图'
    }
]

const options = {
    title: 'Company Performance',
    is3D: true,
  };
 
  const data = [
    ['Task', 'Hours per Day'],
    ['Work', 11],
    ['Eat', 2],
    ['Commute', 2],
    ['Watch TV', 2],
    ['Sleep', 7],
  ];

const Chart = () => {
    // const dispatch = useDispatch()
    // let [count, setCounter] = useState([]) 
    // 获取redux中的渠道列表
    const handleChange = (value) => {
        console.log(`selected ${value}`);
    };
    return (
        <div>
            <div>
                统计图：
                <Select
                    defaultValue="bar"
                    style={{
                        width: 120,
                    }}
                    onChange={handleChange}
                    options={sOptions}
                    />
            </div>
            <div style={{ width: '400px', height: '400px' }}>
                <PieChart
                    data={data}
                    options={options}
                />
            </div>
        </div>
    )
}

export default Chart